<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 1.剩余参数，数组方法sort排序
      const getsort = (...arr) => {
        return arr.sort((a, b) => {
          return a - b
        })
      }
      const res = getsort(1, 25, 35, 23, 9)
      console.log(res)

      //2. 三维数组解构
      const arr1 = [20, [30, 40, [50, 60]]]
      const [a, [b, c, [d, e]]] = arr1
      console.log(a, b, c, d, e)

      // 3.多级对象解构
      const resObj = {
        code: 200,
        message: '登陆成功！',
        data: {
          userName: '张三',
          nickName: '三三',
          age: 18,
          email: '358121578@qq.com'
        }
      }
      const {
        code,
        message,
        data: { userName, nickName, age, email }
      } = resObj
      console.log(code, message, userName, nickName, age, email)
//      展开运算符合并新数组
      const arr3 = [1,2,3,4]
      const arr4 = [5,6,7,8]
      const arr5 = [...arr3,...arr4]
      console.log(arr5);



    </script>
  </body>
</html>
